
public abstract class AbstractAccount {
	/**
	 * the account number for this account.
	 */
	private int fAccountNumber;
	/**
	 * The owner of this account.
	 */
	private Person my_owner;
	/**
	 * the balance of this account.
	 */
	private double fBalance;
	
	/**
	 * The next account number to be applied to a newly created account.
	 */
	private static int fNextAccountNumber = 0;

	
	/**
	 * Constructs a new account based on the provided account number.
	 * @param accountNumber
	 */
	public AbstractAccount(int accountNumber) 
	{
		fAccountNumber = accountNumber;
		fBalance = 0;
	}
	
	/**
	 * Creates a new account for the passed in owner, with the passed in balance.
	 * @param the_owner
	 * @param the_balance double representing the starting balance.
	 */
	public AbstractAccount(Person the_owner, 
			               double the_balance)
	{
		this(fNextAccountNumber);
		fNextAccountNumber++;
		my_owner = the_owner;
		fBalance = the_balance;
	}

	
	/**
	 * Creates a new account for the provided owner.
	 * @param the_owner
	 */
	public AbstractAccount(final Person the_owner)
	{
		this(the_owner, 0);
	}
	
	/**
	 * Method to be overridden. Withdraws money from the account, while checking whether a withdrawal is allowed.
	 * @param amount
	 * @return whether or not the withdrawal was allowed.
	 */
	public abstract boolean withdrawal(double amount);
	
	
	/**
	 * This method reverses a transaction by the amount provided, adding that amount to the account.
	 * 
	 * @param amount
	 */
	public void verseMoney(double amount)
	{
		fBalance += amount;
	}

	
	
	/**
	 * Returns this accounts balance.
	 * @return
	 */
	public double getBalance() 
	{
		return fBalance;
	}
	
	
	/**
	 * Sets this accounts balance.
	 * @param newBalance the balance to set to.
	 */
	protected void setBalance(double newBalance) 
	{
		fBalance = newBalance;
		return;
	}
	
	/**
	 * Gets this accounts owner object.
	 * @return Person object representing the owner.
	 */
	protected Person getOwner()
	{
		return my_owner;
	}
	
	
	/**
	 * Gets this accounts account number.
	 * @return
	 */
	protected int getAccountNumber()
	{
		return fAccountNumber;
	}
	
	
}
